package com.idev.common.job;

import org.apache.commons.lang.time.*;
import org.springframework.stereotype.Component;

/**
 * Created by yigeyanse on 2017/6/16.
 */
@Component
public class ScheduleJobs{
    public final static long SECOND = 1 * 1000;
    FastDateFormat fdf = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss");

    /*@Scheduled(fixedDelay = SECOND * 2) //固定等待时间 @Scheduled(fixedDelay = 时间间隔 )
    public void fixedDelayJob() throws InterruptedException {
        TimeUnit.SECONDS.sleep(2);
        System.out.println("[FixedDelayJob Execute]"+fdf.format(new Date()));
    }

    @Scheduled(fixedRate = SECOND * 4) //固定间隔时间 @Scheduled(fixedRate = 时间间隔 )
    public void fixedRateJob() {
        System.out.println("[FixedRateJob Execute]"+fdf.format(new Date()));
    }

    @Scheduled(cron = "0/4 * * * * ?") //Corn表达式 @Scheduled(cron = Corn表达式)
    public void cronJob() {
        System.out.println("[CronJob Execute]"+fdf.format(new Date()));
    }*/
}
